package com.sumer.function;

import java.util.function.Function;

/**
 * Function接口测试
 */
public class FunctionTest {

    public static void main(String[] args) {
        Function<String,String> function = new Function<String,String>() {
            @Override
            public String apply(String string) {
                return "Hello " + string;
            }
        };

        // 通过lambda简化
        Function<String,String> function1 = string -> "Hello " + string;

        System.out.println(function.apply("world"));
        System.out.println(function1.apply("world"));
    }
}
